home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / TeX-inputs / LaTeX / tools / tabularx.sty < prev    next >
Text File  |  1997-03-07  |  6KB  |  182 lines

  1. %%
  2. %% This is file `tabularx.sty',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% tabularx.dtx  (with options: `package')
  8. %% 
  9. %% IMPORTANT NOTICE:
  10. %% 
  11. %% This file is a generated file from the sources of the `tools' bundle
  12. %% in the LaTeX2e distribution.
  13. %% 
  14. %% For the copyright notice see the source file(s).
  15. %% 
  16. %% You are not allowed to modify this file.
  17. %% 
  18. %% You are allowed to distribute this file if and only if
  19. %% it is distributed with the corresponding source files in
  20. %% the `tools' bundle.
  21. %% 
  22. %% For the copying and distribution conditions of the source files,
  23. %% see the file readme.txt distributed with the tools bundle.
  24. %% 
  25. %% File: tabularx.dtx Copyright (C) 1991-1997 David Carlisle
  26. \NeedsTeXFormat{LaTeX2e}
  27. \ProvidesPackage{tabularx}
  28.           [1997/02/26 v2.04 `tabularx' package (DPC)]
  29. \DeclareOption{infoshow}{\AtEndOfPackage\tracingtabularx}
  30. \DeclareOption{debugshow}{\AtEndOfPackage\tracingtabularx}
  31. \ProcessOptions
  32. \RequirePackage{array}[1994/02/03]
  33. \newdimen\TX@col@width
  34. \newdimen\TX@old@table
  35. \newdimen\TX@old@col
  36. \newdimen\TX@target
  37. \newdimen\TX@delta
  38. \newcount\TX@cols
  39. \newif\ifTX@
  40. \def\tabularx#1{%
  41. \edef\TX@{\@currenvir}%
  42.   {\ifnum0=`}\fi
  43.   \TX@target#1\relax
  44.   \TX@typeout{Target width: #1 = \the\TX@target.}%
  45.   \toks@{}\TX@get@body}
  46.  
  47. \let\endtabularx\relax
  48. \long\def\TX@get@body#1\end
  49.   {\toks@\expandafter{\the\toks@#1}\TX@find@end}
  50. \def\TX@find@end#1{%
  51.   \def\@tempa{#1}%
  52.   \ifx\@tempa\TX@\expandafter\TX@endtabularx
  53.   \else\toks@\expandafter
  54.     {\the\toks@\end{#1}}\expandafter\TX@get@body\fi}
  55. \def\TX@{tabularx}
  56. \def\TX@endtabularx{%
  57.   \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}%
  58.   \let\verb\TX@verb
  59.   \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
  60.   \edef\TX@ckpt{\cl@@ckpt}%
  61.   \let\@elt\relax
  62.   \TX@old@table=\maxdimen
  63.   \TX@col@width=\TX@target
  64.   \global\TX@cols=\@ne
  65.   \TX@typeout@
  66.     {\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
  67.   \TX@trial{\def\NC@rewrite@X{%
  68.           \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}%
  69.   \loop
  70.     \TX@arith
  71.     \ifTX@
  72.     \TX@trial{}%
  73.   \repeat
  74.   {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
  75.     \csname tabular*\expandafter\endcsname\expandafter\TX@target
  76.       \the\toks@
  77.     \csname endtabular*\endcsname}%
  78.   \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
  79.   \ifnum0=`{\fi}%
  80.   \expandafter\end\expandafter{\TX@}}
  81. \def\TX@arith{%
  82.   \TX@false
  83.   \ifdim\TX@old@table=\wd\@tempboxa
  84.     \TX@col@width=\TX@old@col
  85.     \TX@typeout@{Reached minimum width, backing up.}%
  86.   \else
  87.     \dimen@=\wd\@tempboxa
  88.     \advance\dimen@ -\TX@target
  89.     \ifdim\dimen@<\TX@delta
  90.       \TX@typeout@{Reached target.}%
  91.     \else
  92.       \ifnum\TX@cols>\@ne
  93.         \advance\TX@cols by \m@ne
  94.       \fi
  95.       \divide\dimen@ by \TX@cols
  96.       \advance\dimen@ by -\TX@col@width
  97.       \ifdim \dimen@ > \z@
  98.         \PackageWarning{tabularx}%
  99.            {X Columns too narrow (table too wide)\MessageBreak}%
  100.         \TX@col@width\TX@error@width\relax
  101.       \else
  102.         \TX@old@col=\TX@col@width
  103.         \TX@old@table=\wd\@tempboxa
  104.         \TX@col@width=-\dimen@
  105.         \TX@true
  106.       \fi
  107.     \fi
  108.   \fi}
  109. \def\TX@error@width{1em}
  110. \TX@delta=\hfuzz
  111. \newcolumntype{X}{}
  112. \def\tabularxcolumn#1{p{#1}}
  113. \def\TX@newcol{\newcol@{X}[0]}
  114. \def\TX@trial#1{%
  115.   \setbox\@tempboxa=\hbox{%
  116.     #1\relax
  117.   \let\@footnotetext\TX@trial@ftn
  118.   \let\TX@vwarn\@empty
  119.    \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
  120.    \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
  121.    \let\immediate=\relax\def\write##1##{{\afterassignment}\toks@=}%
  122.     \hbadness=\@M\hfuzz=\maxdimen
  123.     \let\hbadness=\@tempcnta\let\hfuzz=\@tempdima
  124.     \expandafter\tabular\the\toks@
  125.     \endtabular}%
  126.   \TX@ckpt
  127.   \TX@typeout@{\@spaces
  128.      \expandafter\TX@align
  129.         \the\wd\@tempboxa\space\space\space\space\space\@@
  130.      \expandafter\TX@align
  131.         \the\TX@col@width\space\space\space\space\space\@@
  132.      \@spaces\the\TX@cols}}
  133. \def\TX@align#1.#2#3#4#5#6#7#8#9\@@{%
  134.   \ifnum#1<10 \space\fi
  135.   \ifnum#1<100 \space\fi
  136.   \ifnum#1<\@m\space\fi
  137.   \ifnum#1<\@M\space\fi
  138.   #1.#2#3#4#5#6#7#8\space\space}
  139. \def\arraybackslash{\let\\=\@arraycr}
  140. \def\tracingtabularx{%
  141.   \def\TX@typeout{\PackageWarningNoLine{tabularx}}%
  142.   \def\TX@typeout@##1{\typeout{(tabularx) ##1}}}
  143. \let\TX@typeout\@gobble
  144. \let\TX@typeout@\@gobble
  145. \newtoks\TX@ftn
  146. \long\def\TX@ftntext#1{%
  147.   \edef\@tempa{\the\TX@ftn\noexpand\footnotetext
  148.                     [\the\csname c@\@mpfn\endcsname]}%
  149.   \global\TX@ftn\expandafter{\@tempa{#1}}}%
  150. \long\def\TX@xftntext[#1]#2{%
  151.   \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}}
  152. \long\def\TX@trial@ftn#1{}
  153. {\uccode`\*=`\ %
  154. \uppercase{\gdef\TX@verb{%
  155.   \leavevmode\null\TX@vwarn
  156.   {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
  157.   \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
  158. \def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
  159.     \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
  160. \def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
  161. \begingroup
  162. \catcode`\*=\catcode`\#
  163. \catcode`\#=12
  164. \gdef\TX@vfirst{%
  165.   \if\@tempa#%
  166.     \def\@tempb{\TX@v@#}%
  167.   \else
  168.     \let\@tempb\TX@v@
  169.     \if\@tempa\space~\else\@tempa\fi
  170.   \fi
  171.   \@tempb}
  172. \gdef\TX@v@*1 *2{%
  173.   \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
  174. \gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}
  175. \endgroup
  176. \def\TX@vwarn{%
  177.   \@warning{\noexpand\verb may be unreliable inside tabularx}%
  178.   \global\let\TX@vwarn\@empty}
  179. \endinput
  180. %%
  181. %% End of file `tabularx.sty'.
  182.